﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using Relocation.Com.Tools;
using Relocation.Com;

namespace Relocation.Forms.Other
{
	public partial class SendSuggest : Base.UI.BaseForm
	{

		
		public SendSuggest():base()
		{
			InitializeComponent();
		}

		private void ButtonClose_Click(object sender, EventArgs e)
		{
			if(this.TextBoxInfo.Text.Length>0)
			{
				DialogResult DialogResult = MyMessagebox.Confirm("您去确定要放弃发送吗？");
				if (DialogResult.Equals(DialogResult.No))
					return;
				this.Close();				
			}
		}

		private void ButtonSend_Click(object sender, EventArgs e)
		{
			string SuggestMessage = this.TextBoxInfo.Text;
			if (SuggestMessage == null || SuggestMessage == "")
				return;

			ThreadPool.QueueUserWorkItem(new WaitCallback(delegate(object obj) {
				try
				{
					Tools.SendSuggest(SuggestMessage);
				}
				catch (Exception ex)
				{
					Log.Error(ex.InnerException==null?ex.Message:ex.InnerException.Message);					
				}
			}));
			this.Close();
			
		}
	}
}
